package com.corona.game.util.pool;

import com.badlogic.gdx.utils.Pool;

/* loaded from: pokewilds.jar:com/pkmngen/game/util/pool/AutoPoolable.class */
public class AutoPoolable<T> implements AutoCloseable, Pool.Poolable {
    private final Pool<AutoPoolable<T>> pool;
    private final Pool<T> tPool;
    private T t;

    public AutoPoolable(Pool<AutoPoolable<T>> pool, Pool<T> tPool) {
        this.pool = pool;
        this.tPool = tPool;
    }

    @Override // java.lang.AutoCloseable
    public void close() {
        this.pool.free(this);
    }

    public T get() {
        return this.t;
    }

    public void set(T t) {
        this.t = t;
    }

    @Override // com.badlogic.gdx.utils.Pool.Poolable
    public void reset() {
        this.tPool.free(this.t);
        this.t = null;
    }
}
